[MINOR] Persist the Maven build cache between CI runs - #882
Open
slachiewicz wants to merge 1 commit into
Open
Conversation
.mvn/extensions.xml enables maven-build-cache-extension, but the cache never survives a CI run: actions/setup-java's `cache: maven` persists ~/.m2/repository only, while the extension writes to ~/.m2/build-cache. The effect is visible in any recent build log - ten modules, ten "Local build was not found by checksum" lines, zero restores - so every run rebuilds and retests all ten modules from scratch, including for pull requests that touch only the website or a single module. Restore ~/.m2/build-cache before the build and save it afterwards. Only main writes an entry; pull requests restore from main's rather than each branch consuming the repository-wide 10 GB cache budget. Source Build Check is deliberately left alone - it passes -Dmaven.build.cache.enabled=false and skips `cache: maven` on purpose, to prove the source release builds without prebuilt artifacts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the pull request
.mvn/extensions.xmlenablesmaven-build-cache-extension, but the cache never survives a CI run, so it currently costs us the bookkeeping and buys nothing.actions/setup-javawithcache: mavenpersists~/.m2/repository. The extension writes to~/.m2/build-cache, which is not covered, so it starts empty every time. This is visible in any recent build log — ten modules, tenLocal build was not found by checksumlines, zero restores:Every run therefore rebuilds and retests all ten modules from scratch, including for pull requests that touch only the website, a workflow file, or a single leaf module.
Brief change log
~/.m2/build-cachebefore the Maven build and save it afterwards, in.github/workflows/mvn-ci-build.ymlNotes on the specific shape of the change:
actions/cache/restore+actions/cache/saveare used instead of plainactions/cacheso that onlymainwrites an entry. Pull requests restore frommain's cache rather than each branch filling the repository-wide 10 GB cache budget — which matters here, since cached module output includes the shadedxtable-utilitiesbundle and would otherwise compete with the~/.m2/repositorycache for the same quota.Source Build Checkis deliberately left alone. It passes-Dmaven.build.cache.enabled=falseand skipscache: mavenon purpose, to prove the source release builds without prebuilt artifacts; caching there would defeat the check.-Dmaven.build.cache.enabled=false.Verify this pull request
This pull request is a build/CI infrastructure change with no production code touched.
Verified locally that the extension does restore once the directory survives, which is the premise of the change. Two consecutive
./mvnw clean install -ntp -B -DskipTestsruns on Temurin 11, with~/.m2/build-cachedeleted before the first:Found cached buildLocal build was not found by checksumThe warm run reports
Skipping plugin execution (cached)forsurefire:test,apache-rat:check,lombok:delombokand the rest, which is where the bulk of CI time goes.That measurement is the fully-unchanged best case. In practice the saving depends on what a pull request touches: a change to
xtable-corestill rebuilds and retests core and everything downstream of it, while a website, workflow, or docs-only change should hit on all ten. The workflow YAML itself is not a build input, so this change does not invalidate module checksums.Also worth a separate look: the extension is pinned at 1.1.0 and 1.2.3 was released 2026-05-22.